<template>
	<view class="content">
		<view class="poster">
			<view v-if="type == 3">
				<view class="type2">
					<view class="left">
						<image :src="list[0].url" class="left_img" mode="aspectFill" @click="toUrl(list[0].link)"></image>
					</view>
					<view class="right">
						<view class="right1">
							<image :src="list[1]?list[1].url:''" class="right_img" mode="aspectFill" @click="toUrl(list[1].link)"></image>
						</view>
						<view class="right1">
							<image :src="list[2]?list[2].url:''" class="right_img" mode="aspectFill" @click="toUrl(list[2].link)"></image>
						</view>
					</view>
				</view>
			</view>
			<view v-if="type == 2">
				<view class="type2">
					<view class="right">
						<view class="right1">
							<image :src="list[0].url" class="right_img" mode="aspectFill" @click="toUrl(list[0].link)"></image>
						</view>
						<view class="right1">
							<image :src="list[1]?list[1].url:''" class="right_img" mode="aspectFill" @click="toUrl(list[1].link)"></image>
						</view>
					</view>
					<view class="left">
						<image :src="list[2]?list[2].url:''" class="left_img" mode="aspectFill" @click="toUrl(list[2].link)"></image>
					</view>
				</view>
			</view>
			<view v-if="type==1">
				<image :src="list[0].url" class="type1" mode="aspectFill" @click="toUrl(list[0].link)"></image>
			</view>
		</view>
	</view>
</template>
<script setup>  
import { ref, watch, computed } from 'vue';  
  
const props = defineProps({  
  type: {  
    type: Number,  
    default: 1, // 0: 一排3个, 1: 一排4个, 2: 一排5个  
  },  
  list: {  
    type: Array,  
    default: () => []  
  }  
});  
function	toUrl(link){
		let url = link
		var Tab = Tab = ['pages/index/index', '/pages/cat/cat', '/pages/personal/index']
		if (url == '' || url == '1') {
			// #ifndef  MP-WEIXIN 
			// uni.showToast({
			// 	icon:'none',
			// 	title:'暂未开放'
			// })
			return false;
			//  #endif 
		}
		if (Tab.indexOf(url) != -1) {
			uni.switchTab({
				url: url
			})
			return
		} else if (url.indexOf("www") >= 0 || url.indexOf("http") >= 0 || url.indexOf("https") >= 0) {
			uni.navigateTo({
				url: `/pages/company/skip?url=${url}`
			})
		} else {
			uni.navigateTo({
				url: url
			})
		}
	} 
</script>


<style lang="scss" scoped>
	.content{
		margin: 30upx;
		.poster{
			background-color: #fff;
			padding: 10upx;
			border-radius: 10upx;
		}
	}
	.type1{
		width: 702rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}
	.type2{
		display: flex;
		justify-content: space-between;
		.left{
			width: 330rpx;
			height: 330rpx;
			.left_img{
				width: 330rpx;
				height: 330rpx;
				border-radius: 12rpx 12rpx 12rpx 12rpx;
			}
		}
		.right{
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			.right_img{
				width: 330rpx;
				height: 156rpx;
				border-radius: 12rpx 12rpx 12rpx 12rpx;
			}
		}
		.right1{
			width: 330rpx;
			height: 156rpx;
		}
	}
</style>